{
  //联合类型
  let u: "mon" | "tues" | "wed" | "thu" | "fri" | "sat" | "sun";
  u = "mon";

  let u2: string | number;
  u2 = "xxx";
  u2 = 12411;
  u2 = NaN;

  //类型断言
  //方式一
  // let div = document.querySelector('div') as HTMLDivElement;
  // div.style.background = '#cea';

  //方式二
  // let div = document.querySelector('div');
  // (<HTMLDivElement>div).style.background = '#cea';

  //类型推断   根据值的类型, 推断变量的类型
  let xx = 100;
  // xx = 'sss';
  //下面变量的类型推断结果为 『any』
  let xxx;
  xxx = 100;
  xxx = "abc";
  xxx = [];

  //报错
  let a = 100;
}
